<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增医院报模版关系')"/>
    <th:block th:include="include :: bootstrap-select-css"/>

</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-report-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">机构：</label>
            <div class="col-sm-8">
                <select id="deptId" name="deptId" class="form-control noselect2 selectpicker"  data-none-selected-text="请选择报表"
                        required>
                    <option th:each="dept : ${@dep.getReportDept()}"
                            th:value="${dept.deptId}"
                            th:text="${dept.deptName}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">类型：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('yf_report_type')}">
                    <input type="radio" th:id="${'filterType_' + dict.dictCode}" name="filterType"
                           th:value="${dict.dictValue}"
                           th:checked="${dict.default}" required>
                    <label th:for="${'filterType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">报表：</label>
            <div class="col-sm-8">
                <select id="componentId" name="reportConfig" class="form-control noselect2 selectpicker"  data-none-selected-text="请选择报表"
                        required multiple>
                    <option th:each="report : ${@yf.getReportAll()}" th:value="${report.id}"
                            th:data-subtext="${report.remark}"
                            th:text="${report.rTName}"></option>
                </select>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-select-js"/>


<script type="text/javascript">

    var prefix = ctx + "yf/report"


    // $("#componentId").on('shown.bs.select',function(e){
    //     $('.dropdown-menu').css('min-height',300);
    //     $('.dropdown-menu').css('transform','translate3d(0px, 29px, 0px)');
    //     $('#componentId').parent().find("input").keydown(function(){
    //         $('.dropdown-menu').css('min-height',240);
    //         $('.dropdown-menu').css('transform','translate3d(0px, 29px, 0px)');
    //     })
    // })

    $("#deptId").selectpicker({
        showTick: true,
        liveSearch: true,
        noneResultsText: "没找到相应记录{0}",
        actionsBox: true,
    });


    $("#componentId").selectpicker({
        showTick: true,
        liveSearch: true,
        noneResultsText: "没找到相应记录{0}",
        actionsBox: true,
        //取消全选按钮标题
        deselectAllText: "取消全选",
        //全选按钮标题
        selectAllText: "全选",
    });

    $("#form-report-add").validate({
        focusCleanup: true,
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-report-add').serialize());
        }
    }
</script>
<style>
    .noselect2{
        color: black;
    }
</style>
</body>
</html>